<?php
defined('IN_TS') or die('Access Denied.');  

class mobile extends tsApp{
	
	//构造函数
	public function __construct($db){
		parent::__construct($db);
	}
	
	//用户是否存在
	public function isUser($userid){
		$isUser = $this->findCount('user',array('userid'=>$userid));
		if($isUser == 0){
			return false;
		}else{
			return true;
		}
	}
	
	//是否登录 
	public function isLogin(){
		$userid = intval($_SESSION['tsuser']['userid']);
		if($userid>0){
			if($this->isUser($userid)){
				return $userid;
			}else{
				header("Location: ".tsUrl('mobile','login',array('ts'=>'out')));
				exit;
			}
		}else{
			header("Location: ".tsUrl('mobile','login',array('ts'=>'out')));
			exit;
		}
	}
	
	
}
